USE [master]
GO

-- Delete database
IF db_id('TrollAMAP') IS NOT NULL
DROP DATABASE TrollAMAP
GO

-- Create a fresh database
CREATE DATABASE TrollAMAP
GO


-- Create login Julien
IF NOT EXISTS 
    (SELECT name  
     FROM master.sys.server_principals
     WHERE name = 'Julien')
BEGIN
    CREATE LOGIN [Julien] WITH PASSWORD = N'123456'
END

-- Give Julien dbo on TrollAMAP
USE [TrollAMAP]
GO
EXEC sp_changedbowner @loginame = 'Julien'
GO


